package net.codeyouth.codegen

import net.codeyouth.codegen.bean.JavaBean
import net.codeyouth.codegen.buider.BaseDaoBuilder
import net.codeyouth.codegen.buider.BaseServiceBuilder
import net.codeyouth.codegen.buider.BeanBuilder
import net.codeyouth.codegen.buider.DaoBuilder
import net.codeyouth.codegen.buider.ServiceBuilder
import org.slf4j.LoggerFactory

/**
 * @author Frank create on 16/2/22 14:10
 */
class CodeGenerator {

    private static final LOGGER = LoggerFactory.getLogger(CodeGenerator.class)

    BeanProvider provider
    List<JavaBean> beanList

    CodeGenerator() {
        provider = new BeanProvider()
        beanList = provider.provide()
    }

    void generate() {
        beanList.each { bean ->
            BeanBuilder.init(bean).build()
            BaseDaoBuilder.build()
            BaseServiceBuilder.build()
            DaoBuilder.init(bean).build()
            ServiceBuilder.init(bean).build()
        }
    }

}
